package test.pcs;

import com.payment.lc.pcs.client.wrap.bo.ProductionPurchaseAttributes;
import com.payment.lc.pcs.client.wrap.service.ProductionWrapService;
import com.payment.lc.pcs.common.enums.BizType;
import com.payment.lc.pcs.common.util.DateUtil;
import com.payment.lc.pcs.service.api.AppSettingService;
import com.payment.lc.pcs.service.api.DynamicDataService;
import com.payment.lc.pcs.service.api.ProductionService;
import com.payment.lc.pcs.service.api.fund.JMFundService;
import com.payment.lc.pcs.service.api.modify.InterestRateService;
import com.payment.lc.pcs.service.bo.ProductionSellInfo;
import com.payment.lc.pcs.service.domain.*;
import com.payment.lc.pcs.service.request.FundTopicRequest;
import com.payment.lc.pcs.service.request.GetFundListReq;
import com.payment.lc.pcs.service.request.InterestRateImportRequest;
import com.payment.lc.pcs.service.response.BaseResponse;
import com.payment.lc.pcs.service.response.FundTopicResp;
import com.payment.lc.pcs.service.response.GetFundListResp;
import com.payment.lc.pcs.util.DateComputeUtil;
import com.sun.xml.internal.ws.policy.jaxws.PolicyWSDLGeneratorExtension;
import net.rubyeye.xmemcached.MemcachedClient;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import test.BaseTest;

import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 * Created on 2016/8/8.
 */
public class Demo2PcsTest4 extends BaseTest {
    private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");

    @Autowired
    DateComputeUtil dateComputeUtil;

    @Autowired
    DynamicDataService dynamicDataService;
    @Autowired
    ProductionWrapService productionWrapService;

    @Test
    public void test() {
        test2();
    }

    void test2() {
        Production production = productionWrapService.getProduction("17120011");
        ProductionPurchaseAttributes purchaseAttributes = productionWrapService.getProductionPurchaseAttributes(production);
        display(purchaseAttributes);
    }
    void test1() {
        Date date = new Date();
        display(DateUtil.getLongWebDateString(date));
        Date date1 = dateComputeUtil.computeWorkDay(date, -2);
        display(DateUtil.getLongWebDateString(date1));
    }
    void test7() {
        Calendar start = Calendar.getInstance();
        Calendar end = Calendar.getInstance();
        start.clear();
        start.set(Calendar.YEAR, 2017);

        end.clear();
        end.set(Calendar.YEAR, 2018);

        String date1 = DateUtil.getWebDateString(start.getTime());
        String date2 = DateUtil.getWebDateString(end.getTime());

        display(date1);
        display(date2);

        String period = "W+1";
        while (start.before(end)) {
            Date date = dateComputeUtil.compute(start.getTime(), period);
            System.out.println(DateUtil.getDateNoTimeString(date));
            start.setTime(date);
        }
    }
}